package org.android.kumoh_ing;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.Toast;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;
 
/**
 * Map and overlays displaying current location
 *
 * @author Mike
 */
public class ItemOverlay extends ItemizedOverlay {

    private Context mContext;
    private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
   
   public ItemOverlay(Drawable defaultMarker, Context context) {
        super(boundCenterBottom(defaultMarker));
        // TODO Auto-generated constructor stub
        mContext = context;
    }

   @Override
    protected OverlayItem createItem(int i) {
        // TODO Auto-generated method stub
        return mOverlays.get(i);
    }

   @Override
    public int size() {
        // TODO Auto-generated method stub
        return mOverlays.size();
    }

   public void addOverlay(OverlayItem overlay)
    {
        mOverlays.add(overlay);
        populate();
    }

   @Override
    protected boolean onTap(int index) {
       OverlayItem item = mOverlays.get(index);
       Toast.makeText(mContext,item.getSnippet(), Toast.LENGTH_SHORT).show();
       return true;
   }
   



}



 


